<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p>苹果10 ¥ / 斤,折扣< 8 折 ></p>
        <p>请输入你要购买的斤数<input type="text" v-model="price"></p>
        <button @click="isHSow = true">结账买单</button>
        <p v-show="isHSow">结账单：总价 <span>{{ 10 * price}}</span>元 折后价：<span>{{ 10*price*0.8 }}</span>省了：<span>{{ 10*price*0.2}}</span></p>
    </div>
    <script src="../vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data:{
                price:'',
                isHSow:false,
            },
            watch:{
            'price'(){
                console.log('触发了')
                this.isHSow = false
            }
        }
        })
        
    </script>
</body>
</html>